package OperateurSystem;

/**
 * Interface definition : GestionColis
 * 
 * @author OpenORB Compiler
 */
public abstract class GestionColisPOA extends org.omg.PortableServer.Servant
        implements GestionColisOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestionColis _this()
    {
        return GestionColisHelper.narrow(_this_object());
    }

    public GestionColis _this(org.omg.CORBA.ORB orb)
    {
        return GestionColisHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:OperateurSystem/GestionColis:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("accordLivraison")) {
                return _invoke_accordLivraison(_is, handler);
        } else if (opName.equals("calculerPrix")) {
                return _invoke_calculerPrix(_is, handler);
        } else if (opName.equals("demanderSuiviColis")) {
                return _invoke_demanderSuiviColis(_is, handler);
        } else if (opName.equals("deposerColisA")) {
                return _invoke_deposerColisA(_is, handler);
        } else if (opName.equals("deposerColisF")) {
                return _invoke_deposerColisF(_is, handler);
        } else if (opName.equals("retirerColis")) {
                return _invoke_retirerColis(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_demanderSuiviColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        try
        {
            String _arg_result = demanderSuiviColis(arg0_in);

            _output = handler.createReply();
            _output.write_string(_arg_result);

        }
        catch (OperateurSystem.GestionColisPackage.ColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_accordLivraison(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();
        int arg1_in = _is.read_long();

        try
        {
            int _arg_result = accordLivraison(arg0_in, arg1_in);

            _output = handler.createReply();
            _output.write_long(_arg_result);

        }
        catch (OperateurSystem.GestionColisPackage.ColisDejaTransporteException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.ColisDejaTransporteExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_retirerColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        try
        {
            retirerColis(arg0_in);

            _output = handler.createReply();

        }
        catch (OperateurSystem.GestionColisPackage.ColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_deposerColisA(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();
        int arg1_in = _is.read_long();

        try
        {
            int _arg_result = deposerColisA(arg0_in, arg1_in);

            _output = handler.createReply();
            _output.write_long(_arg_result);

        }
        catch (OperateurSystem.GestionColisPackage.ColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_deposerColisF(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();
        int arg1_in = _is.read_long();
        int arg2_in = _is.read_long();

        try
        {
            deposerColisF(arg0_in, arg1_in, arg2_in);

            _output = handler.createReply();

        }
        catch (OperateurSystem.GestionColisPackage.MauvaiseStationException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.MauvaiseStationExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_calculerPrix(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();
        int arg1_in = _is.read_long();

        try
        {
            int _arg_result = calculerPrix(arg0_in, arg1_in);

            _output = handler.createReply();
            _output.write_long(_arg_result);

        }
        catch (OperateurSystem.GestionColisPackage.DestinataireInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.DestinataireInexistantExceptionHelper.write(_output,_exception);
        }
        catch (OperateurSystem.GestionColisPackage.ColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

}
